﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Delegate
{
    
    class Program
    {

        static void Main(string[] args)
        {
            DelegateText d = new DelegateText();
            string name = "符永丰";
            ////d.making = DelegateText.English; //事件只能出现在 += 或 -= 的左边
            d.making += English;
            d.making += China;
            d.Hello(name);
            Heater h = new Heater();
            Alarm a = new Alarm();
            h.Temperature += a.MakeAlert;
            h.Temperature += (new Alarm()).MakeAlert;
            h.Temperature += Display.ShowTemperature;
            h.BuildHeater();
            //Hello(name, English);
            //Making making;
            //making = China;
            //making += English;
            //Hello(name,making);
            //making -= English;
            //Hello(name, making);
            Console.ReadLine();
        }

        public static void China(string name)
        {
            Console.WriteLine("你好" + name);
        }
        public static void English(string name)
        {
            Console.WriteLine("Hello" + name);
        }
    }
}
